import React, { Component } from "react";
import axios from "axios";
export default class Proxy extends Component {
    render() {
        return (
            <div style={{padding: '20px'}}>
                <button onClick={this.getStudents}>点击获取学员信息</button><br></br>
                <button onClick={this.getCar1}>点击获取汽车 - 1 信息  5000 </button><br></br>
                <button onClick={this.getCar2}>点击获取汽车 - 2 信息  5001</button><br></br>
                <button onClick={this.getBook}>点击获取书籍信息</button><br></br>
                <button onClick={this.getHotMovie}>获取电影信息</button><br></br>
            </div>
        );
    }

    getHotMovie =async () => {
        let result = await axios('/meituan/ptapi/getHotFilms?ci=1&limit=10');
        console.log(result);
    }

    getBook = async () => {
        //发送 AJAX 请求
        let result = await axios.get("/api2/books");
        console.log(result.data);
    }

    getStudents = async () => {
        //发送 AJAX 请求
        let result = await axios.get("/api1/students");
        console.log(result.data);
    };

    getCar1 = async () => {
        let result = await axios('/api1/cars');
        console.log(result);
    };

    getCar2 = async () => {
        let result = await axios('/api2/cars');
        console.log(result);
    };
}
